package com.huaruan.food.biz.admin.role.imp;

import java.util.List;

import com.huaruan.food.biz.admin.role.IRoleManager;
import com.huaruan.food.dao.IDao;
import com.huaruan.food.entity.SysRoleinfo;
import com.huaruan.food.javabean.PageObj;

public class RoleManagerImp implements IRoleManager {
	private IDao dao;

	public void setDao(IDao dao) {
		this.dao = dao;
	}

	@Override
	public boolean addRole(SysRoleinfo role) {
		return dao.addObj(role);
	}

	@Override
	public PageObj<SysRoleinfo> findRole(PageObj<SysRoleinfo> pageObj) {
		List<SysRoleinfo> result = dao.find(pageObj.getQueryObj(),
				pageObj.getCurrPage(), pageObj.getRows());
		if(null!= result && result.size()>0){
			pageObj.setResults(result);
			pageObj.setAllRows(dao.listCount(pageObj.getQueryObj()));
		}
		return pageObj;
	}

	@Override
	public List<SysRoleinfo> getAllRoles() {
		return dao.find(new SysRoleinfo());
	}

}
